home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: What Kind of File do I Have?
- Sent: 6/27/96 4:54 PM
- Received: 6/27/96 5:01 PM
- From: David McCusker, david_mccusker@powertalk.apple.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Ken Boyer (kboyer@itsnet.com) writes:
- > I have a FW_PFileSpecification, is there a way to determine if a file has
- > a valid bento storage unit associated with it?
-
- I don't know FW_PFileSpecification (or any classes in ODF), but if you can
- read any bytes from a file given such a spec, I can tell you how to
- determine whether it appears to be a Bento file (see below).
-
- While an OpenDoc Bento file is a container with a draft inside, it's not
- clear what you mean by having bento storage unit associated with it.
-
- > I have tried using FW_AcquireFileContainer, but it throws an exception
- > inside OpenDoc and causes my part to quit. I would like to open WordPerfect
- > & Word files, and extract data from them.
-
- There do not appear to be any utility functions that answer questions
- like "is this a Bento file?" or "is this an OpenDoc file?" Typically
- OpenDoc tries to open a file using Bento and understands that failure
- probably means the file was not a Bento file. (You should interpret
- an exception thrown in such a context as meaning "this is not an OpenDoc
- file.")
-
- There will probably be a utility function like this in a few months,
- so you might write your own and substitute the standard one when it
- appears (or implement your utility using the standard function).
-
- Currently the last 24 bytes of a file contains the Bento label. The
- first 8 bytes of the label should be the following 8 byte string:
-
- "\xA4" "CM" "\xA5" "Hdr" "\xD7"
-
- or represented completely in hex:
-
- A4 43 4D A5 48 64 72 D7 // . C M . H d r .
-
- Note that while this is always true of OpenDoc files today, this might not
- always be true of OpenDoc files in the future. So you must abstract.
-
- Because this information is a private implementation detail, if you depend
- on this identification of OpenDoc files, you will break in the future. If
- we already had API to do this, we could prevent you from breaking.
-
- Breaking is bad, so to be robust you should only treat this as a heuristic
- that is backed up by alternative means of dealing with OpenDoc files.
- Your part is allowed to behave better when this label is found, but not
- badly when it is not found.
-
- David McCusker, OpenDoc Storage & Bento, david_mccusker@powertalk.apple.com
-
-